var t = getApp();

Page({
  data: {
    curHdIndex: 0,
    currentResult: 0,
    resultList: [],
    moreBoo: !0,
    loadingBoo: !0,
    resultList: [{
        status: 0,
        doctorBaseInfoVO: {
          doctorId: 1,
          userIcon: '/assets/images/796.png',
          doctorName: '小强',
          nmDepartment: '2018-10-30',
          jobType: 1
        },
        orderId: 1,
        patientId: 1,
        medType: 3,
        nonReadCount: 0,
        msgTxt: '准备动手术',
        sessionDateBegin: '2018-10-30',
        teamBaseInfoVo: {
          teamId: 1,
          teamHeaderUrl: '/assets/images/796.png',
          teamName: '小明',
          teamLeaderName: '小红'
        }
      },
      {
        status: 0,
        doctorBaseInfoVO: {
          doctorId: 1,
          userIcon: '/assets/images/796.png',
          doctorName: '小强',
          nmDepartment: '2018-10-30',
          jobType: 1
        },
        orderId: 1,
        patientId: 1,
        medType: 3,
        nonReadCount: 10,
        msgTxt: '准备动手术',
        sessionDateBegin: '2018-10-30',
        teamBaseInfoVo: {
          teamId: 1,
          teamHeaderUrl: '/assets/images/796.png',
          teamName: '小明',
          teamLeaderName: '小红'
        }
      },
      {
        status: 1,
        doctorBaseInfoVO: {
          doctorId: 1,
          userIcon: '/assets/images/796.png',
          doctorName: '小强',
          nmDepartment: '2018-10-30',
          jobType: 1
        },
        orderId: 1,
        patientId: 1,
        medType: 1,
        nonReadCount: 20,
        msgTxt: '准备动手术',
        sessionDateBegin: '2018-10-30',
        teamBaseInfoVo: {
          teamId: 1,
          teamHeaderUrl: '/assets/images/796.png',
          teamName: '小明',
          teamLeaderName: '小红'
        }
      },
      {
        status: 1,
        doctorBaseInfoVO: {
          doctorId: 1,
          userIcon: '/assets/images/796.png',
          doctorName: '小强',
          nmDepartment: '2018-10-30',
          jobType: 1
        },
        orderId: 1,
        patientId: 1,
        medType: 1,
        nonReadCount: 0,
        msgTxt: '准备动手术',
        sessionDateBegin: '2018-10-30',
        teamBaseInfoVo: {
          teamId: 1,
          teamHeaderUrl: '/assets/images/796.png',
          teamName: '小明',
          teamLeaderName: '小红'
        }
      }
    ]
  },
  tapFun: function(e) {
    var a = this;
    console.log(e)
    t.list(e, a),
      a.setData({
        moreBoo: !0,
        loadingBoo: !0
      });
  },
  onLoad: function(t) {
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
  },
  onShow: function() {
    // var t = this;
    // this.setData({
    //   token: wx.getStorageSync("logs"),
    //   currentResult: 0,
    //   resultList: [],
    //   moreBoo: !0
    // }), this.getList(t);
  },
  moreResultRecord: function() {
    console.log(111111);
    var t = this;
    t.data.loadingBoo && t.data.moreBoo && (this.setData({
      loadingBoo: !1
    }), t.getList(t));
  },
  getList: function(e) {
    var a = e.data.resultList;
    wx.request({
      url: t.globalData.patient + "patient/askmed/patientMedOrder/list",
      data: {
        token: e.data.token,
        currentResult: e.data.currentResult
      },
      success: function(o) {
        if (console.log(o), 200 == o.data.code) {
          if (o.data.data.result.length > 0 && o.data.data.result.forEach(function(e) {
              e.sessionDateBegin && (e.sessionDateBegin = t.toDate(e.sessionDateBegin)), a.push(e);
            }), o.data.data.result.length <= 0 && 0 != e.data.currentResult) return void e.setData({
            resultList: a,
            moreBoo: !1,
            loadingBoo: !0
          });
          e.setData({
            resultList: a,
            currentResult: o.data.data.page.nextResult,
            loadingBoo: !0
          });
        }
      }
    });
  }
});